{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 期权示例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "import optshare"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 获取期权数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 返回当前场内期权数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "data": {
      "text/plain": "                 代码              名称    最新价    涨跌额      涨跌幅     成交量       成交额  \\\n0      cu2305P53000  沪铜23年05月沽53000  46.00  44.00  2200.00     3.0     690.0   \n1      cu2304P58000  沪铜23年04月沽58000  34.00  32.00  1600.00    11.0    1870.0   \n2      zn2304P18800  沪锌23年04月沽18800  12.00  11.00  1100.00     9.0     525.0   \n3      cu2305P55000  沪铜23年05月沽55000  46.00  42.00  1050.00     6.0    1410.0   \n4      cu2304P57000  沪铜23年04月沽57000  20.00  18.00   900.00    14.0    1390.0   \n...             ...             ...    ...    ...      ...     ...       ...   \n11285   rb2303P3950  螺纹钢23年03月沽3950   3.00  -7.50   -71.43  5397.0  298560.0   \n11286   ag2303P4700   沪银23年03月沽4700   3.00  -8.00   -72.73  2718.0  268852.0   \n11287   ag2303P4650   沪银23年03月沽4650   1.50  -4.00   -72.73  1051.0   38662.0   \n11288    au2303C424    沪金23年03月购424   0.08  -0.24   -75.00     2.0     140.0   \n11289  ru2303P12000  橡胶23年03月沽12000  10.00 -31.00   -75.61    52.0    4870.0   \n\n          持仓量  行权价  剩余日     日增     昨结     今开  \n0       272.0  NaN  NaN    0.0   2.00  46.00  \n1       141.0  NaN  NaN   -2.0   2.00  34.00  \n2        32.0  NaN  NaN    8.0   1.00  12.00  \n3       126.0  NaN  NaN    5.0   4.00  48.00  \n4       148.0  NaN  NaN    0.0   2.00  22.00  \n...       ...  ...  ...    ...    ...    ...  \n11285  4034.0  NaN  NaN  945.0  10.50   7.50  \n11286  1815.0  NaN  NaN  475.0  11.00   8.00  \n11287  1584.0  NaN  NaN   93.0   5.50   3.50  \n11288     1.0  NaN  NaN    NaN   0.32   0.06  \n11289    99.0  NaN  NaN   37.0  41.00   8.00  \n\n[11290 rows x 13 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>代码</th>\n      <th>名称</th>\n      <th>最新价</th>\n      <th>涨跌额</th>\n      <th>涨跌幅</th>\n      <th>成交量</th>\n      <th>成交额</th>\n      <th>持仓量</th>\n      <th>行权价</th>\n      <th>剩余日</th>\n      <th>日增</th>\n      <th>昨结</th>\n      <th>今开</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>cu2305P53000</td>\n      <td>沪铜23年05月沽53000</td>\n      <td>46.00</td>\n      <td>44.00</td>\n      <td>2200.00</td>\n      <td>3.0</td>\n      <td>690.0</td>\n      <td>272.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>0.0</td>\n      <td>2.00</td>\n      <td>46.00</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>cu2304P58000</td>\n      <td>沪铜23年04月沽58000</td>\n      <td>34.00</td>\n      <td>32.00</td>\n      <td>1600.00</td>\n      <td>11.0</td>\n      <td>1870.0</td>\n      <td>141.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>-2.0</td>\n      <td>2.00</td>\n      <td>34.00</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>zn2304P18800</td>\n      <td>沪锌23年04月沽18800</td>\n      <td>12.00</td>\n      <td>11.00</td>\n      <td>1100.00</td>\n      <td>9.0</td>\n      <td>525.0</td>\n      <td>32.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>8.0</td>\n      <td>1.00</td>\n      <td>12.00</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>cu2305P55000</td>\n      <td>沪铜23年05月沽55000</td>\n      <td>46.00</td>\n      <td>42.00</td>\n      <td>1050.00</td>\n      <td>6.0</td>\n      <td>1410.0</td>\n      <td>126.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>5.0</td>\n      <td>4.00</td>\n      <td>48.00</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>cu2304P57000</td>\n      <td>沪铜23年04月沽57000</td>\n      <td>20.00</td>\n      <td>18.00</td>\n      <td>900.00</td>\n      <td>14.0</td>\n      <td>1390.0</td>\n      <td>148.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>0.0</td>\n      <td>2.00</td>\n      <td>22.00</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>11285</th>\n      <td>rb2303P3950</td>\n      <td>螺纹钢23年03月沽3950</td>\n      <td>3.00</td>\n      <td>-7.50</td>\n      <td>-71.43</td>\n      <td>5397.0</td>\n      <td>298560.0</td>\n      <td>4034.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>945.0</td>\n      <td>10.50</td>\n      <td>7.50</td>\n    </tr>\n    <tr>\n      <th>11286</th>\n      <td>ag2303P4700</td>\n      <td>沪银23年03月沽4700</td>\n      <td>3.00</td>\n      <td>-8.00</td>\n      <td>-72.73</td>\n      <td>2718.0</td>\n      <td>268852.0</td>\n      <td>1815.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>475.0</td>\n      <td>11.00</td>\n      <td>8.00</td>\n    </tr>\n    <tr>\n      <th>11287</th>\n      <td>ag2303P4650</td>\n      <td>沪银23年03月沽4650</td>\n      <td>1.50</td>\n      <td>-4.00</td>\n      <td>-72.73</td>\n      <td>1051.0</td>\n      <td>38662.0</td>\n      <td>1584.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>93.0</td>\n      <td>5.50</td>\n      <td>3.50</td>\n    </tr>\n    <tr>\n      <th>11288</th>\n      <td>au2303C424</td>\n      <td>沪金23年03月购424</td>\n      <td>0.08</td>\n      <td>-0.24</td>\n      <td>-75.00</td>\n      <td>2.0</td>\n      <td>140.0</td>\n      <td>1.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>0.32</td>\n      <td>0.06</td>\n    </tr>\n    <tr>\n      <th>11289</th>\n      <td>ru2303P12000</td>\n      <td>橡胶23年03月沽12000</td>\n      <td>10.00</td>\n      <td>-31.00</td>\n      <td>-75.61</td>\n      <td>52.0</td>\n      <td>4870.0</td>\n      <td>99.0</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>37.0</td>\n      <td>41.00</td>\n      <td>8.00</td>\n    </tr>\n  </tbody>\n</table>\n<p>11290 rows × 13 columns</p>\n</div>"
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "optshare.get_current_option()"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 指定交易所名称，返回当前交易所的期权数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "                代码                名称   最新价   涨跌额      涨跌幅   成交量         成交额  \\\n0    IO2302-C-4150   沪深300购23年2月4150  29.2  18.6  175.47%  9908  20194520.0   \n1    HO2302-C-2800    上证50购23年2月2800   6.6   4.2   175.0%  4712   3041720.0   \n2    IO2302-C-4200   沪深300购23年2月4200   7.8   4.8   160.0%  4973   3137360.0   \n3    HO2302-C-2750    上证50购23年2月2750  36.2  20.0  123.46%  5211  14577260.0   \n4    IO2302-C-4100   沪深300购23年2月4100  68.6  35.6  107.88%  6351  34297000.0   \n..             ...               ...   ...   ...      ...   ...         ...   \n675  MO2302-P-6900  中证1000沽23年2月6900   1.2  -4.0  -76.92%  1684    439820.0   \n676  HO2302-P-2750    上证50沽23年2月2750   2.4 -10.4  -81.25%  3863   2092120.0   \n677  IO2302-P-4100   沪深300沽23年2月4100   2.2 -10.2  -82.26%  7042   3723400.0   \n678  IO2302-P-4050   沪深300沽23年2月4050   0.4  -2.0  -83.33%  2057    149320.0   \n679  MO2302-P-6800  中证1000沽23年2月6800   0.2  -1.4   -87.5%   828     53160.0   \n\n      持仓量     行权价  剩余日   日增    昨结    今开  \n0    4991  4150.0    1  217  10.6  10.2  \n1    3058  2800.0    1   18   2.4   2.6  \n2    6048  4200.0    1 -487   3.0   3.2  \n3    1730  2750.0    1   70  16.2  16.8  \n4    2338  4100.0    1 -429  33.0  34.6  \n..    ...     ...  ...  ...   ...   ...  \n675  2479  6900.0    1   -9   5.2   5.0  \n676  2305  2750.0    1  344  12.8   9.0  \n677  3742  4100.0    1 -590  12.4  11.4  \n678  2203  4050.0    1 -734   2.4   2.0  \n679  2077  6800.0    1 -587   1.6   1.2  \n\n[680 rows x 13 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>代码</th>\n      <th>名称</th>\n      <th>最新价</th>\n      <th>涨跌额</th>\n      <th>涨跌幅</th>\n      <th>成交量</th>\n      <th>成交额</th>\n      <th>持仓量</th>\n      <th>行权价</th>\n      <th>剩余日</th>\n      <th>日增</th>\n      <th>昨结</th>\n      <th>今开</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>IO2302-C-4150</td>\n      <td>沪深300购23年2月4150</td>\n      <td>29.2</td>\n      <td>18.6</td>\n      <td>175.47%</td>\n      <td>9908</td>\n      <td>20194520.0</td>\n      <td>4991</td>\n      <td>4150.0</td>\n      <td>1</td>\n      <td>217</td>\n      <td>10.6</td>\n      <td>10.2</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>HO2302-C-2800</td>\n      <td>上证50购23年2月2800</td>\n      <td>6.6</td>\n      <td>4.2</td>\n      <td>175.0%</td>\n      <td>4712</td>\n      <td>3041720.0</td>\n      <td>3058</td>\n      <td>2800.0</td>\n      <td>1</td>\n      <td>18</td>\n      <td>2.4</td>\n      <td>2.6</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>IO2302-C-4200</td>\n      <td>沪深300购23年2月4200</td>\n      <td>7.8</td>\n      <td>4.8</td>\n      <td>160.0%</td>\n      <td>4973</td>\n      <td>3137360.0</td>\n      <td>6048</td>\n      <td>4200.0</td>\n      <td>1</td>\n      <td>-487</td>\n      <td>3.0</td>\n      <td>3.2</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>HO2302-C-2750</td>\n      <td>上证50购23年2月2750</td>\n      <td>36.2</td>\n      <td>20.0</td>\n      <td>123.46%</td>\n      <td>5211</td>\n      <td>14577260.0</td>\n      <td>1730</td>\n      <td>2750.0</td>\n      <td>1</td>\n      <td>70</td>\n      <td>16.2</td>\n      <td>16.8</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>IO2302-C-4100</td>\n      <td>沪深300购23年2月4100</td>\n      <td>68.6</td>\n      <td>35.6</td>\n      <td>107.88%</td>\n      <td>6351</td>\n      <td>34297000.0</td>\n      <td>2338</td>\n      <td>4100.0</td>\n      <td>1</td>\n      <td>-429</td>\n      <td>33.0</td>\n      <td>34.6</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>675</th>\n      <td>MO2302-P-6900</td>\n      <td>中证1000沽23年2月6900</td>\n      <td>1.2</td>\n      <td>-4.0</td>\n      <td>-76.92%</td>\n      <td>1684</td>\n      <td>439820.0</td>\n      <td>2479</td>\n      <td>6900.0</td>\n      <td>1</td>\n      <td>-9</td>\n      <td>5.2</td>\n      <td>5.0</td>\n    </tr>\n    <tr>\n      <th>676</th>\n      <td>HO2302-P-2750</td>\n      <td>上证50沽23年2月2750</td>\n      <td>2.4</td>\n      <td>-10.4</td>\n      <td>-81.25%</td>\n      <td>3863</td>\n      <td>2092120.0</td>\n      <td>2305</td>\n      <td>2750.0</td>\n      <td>1</td>\n      <td>344</td>\n      <td>12.8</td>\n      <td>9.0</td>\n    </tr>\n    <tr>\n      <th>677</th>\n      <td>IO2302-P-4100</td>\n      <td>沪深300沽23年2月4100</td>\n      <td>2.2</td>\n      <td>-10.2</td>\n      <td>-82.26%</td>\n      <td>7042</td>\n      <td>3723400.0</td>\n      <td>3742</td>\n      <td>4100.0</td>\n      <td>1</td>\n      <td>-590</td>\n      <td>12.4</td>\n      <td>11.4</td>\n    </tr>\n    <tr>\n      <th>678</th>\n      <td>IO2302-P-4050</td>\n      <td>沪深300沽23年2月4050</td>\n      <td>0.4</td>\n      <td>-2.0</td>\n      <td>-83.33%</td>\n      <td>2057</td>\n      <td>149320.0</td>\n      <td>2203</td>\n      <td>4050.0</td>\n      <td>1</td>\n      <td>-734</td>\n      <td>2.4</td>\n      <td>2.0</td>\n    </tr>\n    <tr>\n      <th>679</th>\n      <td>MO2302-P-6800</td>\n      <td>中证1000沽23年2月6800</td>\n      <td>0.2</td>\n      <td>-1.4</td>\n      <td>-87.5%</td>\n      <td>828</td>\n      <td>53160.0</td>\n      <td>2077</td>\n      <td>6800.0</td>\n      <td>1</td>\n      <td>-587</td>\n      <td>1.6</td>\n      <td>1.2</td>\n    </tr>\n  </tbody>\n</table>\n<p>680 rows × 13 columns</p>\n</div>"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "optshare.get_current_option(exchange_name = 'cffex')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 根据挂钩标的代码，返回当前挂钩该标的的期权信息"
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "**权益类**"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "                代码               名称   最新价   涨跌额      涨跌幅    成交量         成交额  \\\n0    IO2302-C-4150  沪深300购23年2月4150  32.0  21.4  201.89%  11053  23850220.0   \n1    IO2302-C-4200  沪深300购23年2月4200   8.2   5.2  173.33%   5613   3696260.0   \n2    IO2302-C-4250  沪深300购23年2月4250   1.8   1.0   125.0%   1124    171140.0   \n3    IO2302-C-4100  沪深300购23年2月4100  74.0  41.0  124.24%   6893  38167780.0   \n4    IO2302-C-4350  沪深300购23年2月4350   0.4   0.2   100.0%    478     13220.0   \n..             ...              ...   ...   ...      ...    ...         ...   \n259  IO2302-P-3950  沪深300沽23年2月3950   0.2  -0.2   -50.0%     91      1860.0   \n260  IO2302-P-4200  沪深300沽23年2月4200  37.0 -50.4  -57.67%   4551  22611380.0   \n261  IO2302-P-4150  沪深300沽23年2月4150  10.4 -28.6  -73.33%   9254  16934580.0   \n262  IO2302-P-4100  沪深300沽23年2月4100   1.8 -10.6  -85.48%   7738   3860440.0   \n263  IO2302-P-4050  沪深300沽23年2月4050   0.2  -2.2  -91.67%   2191    152040.0   \n\n      持仓量     行权价  剩余日   日增    昨结    今开  \n0    5071  4150.0    1  297  10.6  10.2  \n1    5925  4200.0    1 -610   3.0   3.2  \n2    3399  4250.0    1  -92   0.8   0.8  \n3    2298  4100.0    1 -469  33.0  34.6  \n4    1208  4350.0    1 -358   0.2   0.4  \n..    ...     ...  ...  ...   ...   ...  \n259  1455  3950.0    1  -60   0.4   0.2  \n260  2488  4200.0    1 -353  87.4  78.0  \n261  3578  4150.0    1  125  39.0  35.0  \n262  3409  4100.0    1 -923  12.4  11.4  \n263  2105  4050.0    1 -832   2.4   2.0  \n\n[264 rows x 13 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>代码</th>\n      <th>名称</th>\n      <th>最新价</th>\n      <th>涨跌额</th>\n      <th>涨跌幅</th>\n      <th>成交量</th>\n      <th>成交额</th>\n      <th>持仓量</th>\n      <th>行权价</th>\n      <th>剩余日</th>\n      <th>日增</th>\n      <th>昨结</th>\n      <th>今开</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>IO2302-C-4150</td>\n      <td>沪深300购23年2月4150</td>\n      <td>32.0</td>\n      <td>21.4</td>\n      <td>201.89%</td>\n      <td>11053</td>\n      <td>23850220.0</td>\n      <td>5071</td>\n      <td>4150.0</td>\n      <td>1</td>\n      <td>297</td>\n      <td>10.6</td>\n      <td>10.2</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>IO2302-C-4200</td>\n      <td>沪深300购23年2月4200</td>\n      <td>8.2</td>\n      <td>5.2</td>\n      <td>173.33%</td>\n      <td>5613</td>\n      <td>3696260.0</td>\n      <td>5925</td>\n      <td>4200.0</td>\n      <td>1</td>\n      <td>-610</td>\n      <td>3.0</td>\n      <td>3.2</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>IO2302-C-4250</td>\n      <td>沪深300购23年2月4250</td>\n      <td>1.8</td>\n      <td>1.0</td>\n      <td>125.0%</td>\n      <td>1124</td>\n      <td>171140.0</td>\n      <td>3399</td>\n      <td>4250.0</td>\n      <td>1</td>\n      <td>-92</td>\n      <td>0.8</td>\n      <td>0.8</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>IO2302-C-4100</td>\n      <td>沪深300购23年2月4100</td>\n      <td>74.0</td>\n      <td>41.0</td>\n      <td>124.24%</td>\n      <td>6893</td>\n      <td>38167780.0</td>\n      <td>2298</td>\n      <td>4100.0</td>\n      <td>1</td>\n      <td>-469</td>\n      <td>33.0</td>\n      <td>34.6</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>IO2302-C-4350</td>\n      <td>沪深300购23年2月4350</td>\n      <td>0.4</td>\n      <td>0.2</td>\n      <td>100.0%</td>\n      <td>478</td>\n      <td>13220.0</td>\n      <td>1208</td>\n      <td>4350.0</td>\n      <td>1</td>\n      <td>-358</td>\n      <td>0.2</td>\n      <td>0.4</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>259</th>\n      <td>IO2302-P-3950</td>\n      <td>沪深300沽23年2月3950</td>\n      <td>0.2</td>\n      <td>-0.2</td>\n      <td>-50.0%</td>\n      <td>91</td>\n      <td>1860.0</td>\n      <td>1455</td>\n      <td>3950.0</td>\n      <td>1</td>\n      <td>-60</td>\n      <td>0.4</td>\n      <td>0.2</td>\n    </tr>\n    <tr>\n      <th>260</th>\n      <td>IO2302-P-4200</td>\n      <td>沪深300沽23年2月4200</td>\n      <td>37.0</td>\n      <td>-50.4</td>\n      <td>-57.67%</td>\n      <td>4551</td>\n      <td>22611380.0</td>\n      <td>2488</td>\n      <td>4200.0</td>\n      <td>1</td>\n      <td>-353</td>\n      <td>87.4</td>\n      <td>78.0</td>\n    </tr>\n    <tr>\n      <th>261</th>\n      <td>IO2302-P-4150</td>\n      <td>沪深300沽23年2月4150</td>\n      <td>10.4</td>\n      <td>-28.6</td>\n      <td>-73.33%</td>\n      <td>9254</td>\n      <td>16934580.0</td>\n      <td>3578</td>\n      <td>4150.0</td>\n      <td>1</td>\n      <td>125</td>\n      <td>39.0</td>\n      <td>35.0</td>\n    </tr>\n    <tr>\n      <th>262</th>\n      <td>IO2302-P-4100</td>\n      <td>沪深300沽23年2月4100</td>\n      <td>1.8</td>\n      <td>-10.6</td>\n      <td>-85.48%</td>\n      <td>7738</td>\n      <td>3860440.0</td>\n      <td>3409</td>\n      <td>4100.0</td>\n      <td>1</td>\n      <td>-923</td>\n      <td>12.4</td>\n      <td>11.4</td>\n    </tr>\n    <tr>\n      <th>263</th>\n      <td>IO2302-P-4050</td>\n      <td>沪深300沽23年2月4050</td>\n      <td>0.2</td>\n      <td>-2.2</td>\n      <td>-91.67%</td>\n      <td>2191</td>\n      <td>152040.0</td>\n      <td>2105</td>\n      <td>4050.0</td>\n      <td>1</td>\n      <td>-832</td>\n      <td>2.4</td>\n      <td>2.0</td>\n    </tr>\n  </tbody>\n</table>\n<p>264 rows × 13 columns</p>\n</div>"
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "optshare.get_current_option(underlying_code ='000300')"
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "**商品类，以铜期权为例**"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "               代码              名称    最新价    涨跌额      涨跌幅   成交量        成交额  \\\n0    cu2305P53000  沪铜23年05月沽53000   46.0   44.0  2200.0%     0      690.0   \n1    cu2304P58000  沪铜23年04月沽58000   34.0   32.0  1600.0%    10     1870.0   \n2    cu2305P55000  沪铜23年05月沽55000   46.0   42.0  1050.0%     0     1410.0   \n3    cu2304P56000  沪铜23年04月沽56000   20.0   18.0   900.0%     0      700.0   \n4    cu2304P57000  沪铜23年04月沽57000   20.0   18.0   900.0%     9     1390.0   \n..            ...             ...    ...    ...      ...   ...        ...   \n347  cu2306C77000  沪铜23年06月购77000  338.0 -334.0   -49.7%    15    57800.0   \n348  cu2303C72000  沪铜23年03月购72000   20.0  -24.0  -54.55%   706   309080.0   \n349  cu2303C69000  沪铜23年03月购69000  308.0 -384.0  -55.49%  2882  8724790.0   \n350  cu2303C70000  沪铜23年03月购70000  122.0 -206.0   -62.8%  2125  3450170.0   \n351  cu2303C71000  沪铜23年03月购71000   44.0  -88.0  -66.67%   817  1097590.0   \n\n      持仓量  行权价  剩余日   日增     昨结     今开  \n0     272  NaN  NaN    0    2.0   46.0  \n1     141  NaN  NaN   -2    2.0   34.0  \n2     126  NaN  NaN    5    4.0   48.0  \n3      95  NaN  NaN    1    2.0   20.0  \n4     148  NaN  NaN    0    2.0   22.0  \n..    ...  ...  ...  ...    ...    ...  \n347    94  NaN  NaN   14  672.0  328.0  \n348  2841  NaN  NaN  267   44.0   26.0  \n349  1465  NaN  NaN  145  692.0  316.0  \n350  3374  NaN  NaN  345  328.0  156.0  \n351  1651  NaN  NaN   87  132.0   60.0  \n\n[352 rows x 13 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>代码</th>\n      <th>名称</th>\n      <th>最新价</th>\n      <th>涨跌额</th>\n      <th>涨跌幅</th>\n      <th>成交量</th>\n      <th>成交额</th>\n      <th>持仓量</th>\n      <th>行权价</th>\n      <th>剩余日</th>\n      <th>日增</th>\n      <th>昨结</th>\n      <th>今开</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>cu2305P53000</td>\n      <td>沪铜23年05月沽53000</td>\n      <td>46.0</td>\n      <td>44.0</td>\n      <td>2200.0%</td>\n      <td>0</td>\n      <td>690.0</td>\n      <td>272</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>0</td>\n      <td>2.0</td>\n      <td>46.0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>cu2304P58000</td>\n      <td>沪铜23年04月沽58000</td>\n      <td>34.0</td>\n      <td>32.0</td>\n      <td>1600.0%</td>\n      <td>10</td>\n      <td>1870.0</td>\n      <td>141</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>-2</td>\n      <td>2.0</td>\n      <td>34.0</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>cu2305P55000</td>\n      <td>沪铜23年05月沽55000</td>\n      <td>46.0</td>\n      <td>42.0</td>\n      <td>1050.0%</td>\n      <td>0</td>\n      <td>1410.0</td>\n      <td>126</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>5</td>\n      <td>4.0</td>\n      <td>48.0</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>cu2304P56000</td>\n      <td>沪铜23年04月沽56000</td>\n      <td>20.0</td>\n      <td>18.0</td>\n      <td>900.0%</td>\n      <td>0</td>\n      <td>700.0</td>\n      <td>95</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>1</td>\n      <td>2.0</td>\n      <td>20.0</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>cu2304P57000</td>\n      <td>沪铜23年04月沽57000</td>\n      <td>20.0</td>\n      <td>18.0</td>\n      <td>900.0%</td>\n      <td>9</td>\n      <td>1390.0</td>\n      <td>148</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>0</td>\n      <td>2.0</td>\n      <td>22.0</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>347</th>\n      <td>cu2306C77000</td>\n      <td>沪铜23年06月购77000</td>\n      <td>338.0</td>\n      <td>-334.0</td>\n      <td>-49.7%</td>\n      <td>15</td>\n      <td>57800.0</td>\n      <td>94</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>14</td>\n      <td>672.0</td>\n      <td>328.0</td>\n    </tr>\n    <tr>\n      <th>348</th>\n      <td>cu2303C72000</td>\n      <td>沪铜23年03月购72000</td>\n      <td>20.0</td>\n      <td>-24.0</td>\n      <td>-54.55%</td>\n      <td>706</td>\n      <td>309080.0</td>\n      <td>2841</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>267</td>\n      <td>44.0</td>\n      <td>26.0</td>\n    </tr>\n    <tr>\n      <th>349</th>\n      <td>cu2303C69000</td>\n      <td>沪铜23年03月购69000</td>\n      <td>308.0</td>\n      <td>-384.0</td>\n      <td>-55.49%</td>\n      <td>2882</td>\n      <td>8724790.0</td>\n      <td>1465</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>145</td>\n      <td>692.0</td>\n      <td>316.0</td>\n    </tr>\n    <tr>\n      <th>350</th>\n      <td>cu2303C70000</td>\n      <td>沪铜23年03月购70000</td>\n      <td>122.0</td>\n      <td>-206.0</td>\n      <td>-62.8%</td>\n      <td>2125</td>\n      <td>3450170.0</td>\n      <td>3374</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>345</td>\n      <td>328.0</td>\n      <td>156.0</td>\n    </tr>\n    <tr>\n      <th>351</th>\n      <td>cu2303C71000</td>\n      <td>沪铜23年03月购71000</td>\n      <td>44.0</td>\n      <td>-88.0</td>\n      <td>-66.67%</td>\n      <td>817</td>\n      <td>1097590.0</td>\n      <td>1651</td>\n      <td>NaN</td>\n      <td>NaN</td>\n      <td>87</td>\n      <td>132.0</td>\n      <td>60.0</td>\n    </tr>\n  </tbody>\n</table>\n<p>352 rows × 13 columns</p>\n</div>"
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "optshare.get_current_option(underlying_code ='cu')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 获取期权信息"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 支持的交易所名称以及字母简写"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "  交易市场名称  交易市场\n0    sse   上交所\n1   szse   深交所\n2  cffex   中金所\n3   shfe   上期所\n4    dce   大商所\n5   czce   郑商所\n6    ine  上期能源",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>交易市场名称</th>\n      <th>交易市场</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>sse</td>\n      <td>上交所</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>szse</td>\n      <td>深交所</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>cffex</td>\n      <td>中金所</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>shfe</td>\n      <td>上期所</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>czce</td>\n      <td>郑商所</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>ine</td>\n      <td>上期能源</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "optshare.get_exchange_info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 支持的期权品种"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "      标的代码        期权名称\n0   510050   上证50ETF期权\n1   510300  沪深300ETF期权\n2   510500  中证500ETF期权\n3   159919  沪深300ETF期权\n4   159922  中证500ETF期权\n5   159915    创业板ETF期权\n6   000300   沪深300股指期权\n7   000852  中证1000股指期权\n8   000016    上证50股指期权\n9       cu         铜期权\n10      al         铝期权\n11      zn         锌期权\n12      rb       螺纹钢期权\n13      au        黄金期权\n14      ag        白银期权\n15      ru        天胶期权\n16       m        豆粕期权\n17       c        玉米期权\n18       i       铁矿石期权\n19      pg   液化石油天然气期权\n20       l       聚乙烯期权\n21       v      聚氯乙烯期权\n22      pp       聚丙烯期权\n23       p       棕榈油期权\n24       a     黄大豆1号期权\n25       b     黄大豆2号期权\n26       y        豆油期权\n27      SR        白糖期权\n28      CF        棉花期权\n29      TA       PTA期权\n30      MA        甲醇期权\n31      RM       菜籽粕期权\n32      OI       菜籽油期权\n33      PK        花生期权\n34      sc        原油期权",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>标的代码</th>\n      <th>期权名称</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>510050</td>\n      <td>上证50ETF期权</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>510300</td>\n      <td>沪深300ETF期权</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>510500</td>\n      <td>中证500ETF期权</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>159919</td>\n      <td>沪深300ETF期权</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>159922</td>\n      <td>中证500ETF期权</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>159915</td>\n      <td>创业板ETF期权</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>000300</td>\n      <td>沪深300股指期权</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>000852</td>\n      <td>中证1000股指期权</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>000016</td>\n      <td>上证50股指期权</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>cu</td>\n      <td>铜期权</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>al</td>\n      <td>铝期权</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>zn</td>\n      <td>锌期权</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>rb</td>\n      <td>螺纹钢期权</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>au</td>\n      <td>黄金期权</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>ag</td>\n      <td>白银期权</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>ru</td>\n      <td>天胶期权</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>m</td>\n      <td>豆粕期权</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>c</td>\n      <td>玉米期权</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>i</td>\n      <td>铁矿石期权</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>pg</td>\n      <td>液化石油天然气期权</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>l</td>\n      <td>聚乙烯期权</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>v</td>\n      <td>聚氯乙烯期权</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>pp</td>\n      <td>聚丙烯期权</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>p</td>\n      <td>棕榈油期权</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>a</td>\n      <td>黄大豆1号期权</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>b</td>\n      <td>黄大豆2号期权</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>y</td>\n      <td>豆油期权</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>SR</td>\n      <td>白糖期权</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>CF</td>\n      <td>棉花期权</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>TA</td>\n      <td>PTA期权</td>\n    </tr>\n    <tr>\n      <th>30</th>\n      <td>MA</td>\n      <td>甲醇期权</td>\n    </tr>\n    <tr>\n      <th>31</th>\n      <td>RM</td>\n      <td>菜籽粕期权</td>\n    </tr>\n    <tr>\n      <th>32</th>\n      <td>OI</td>\n      <td>菜籽油期权</td>\n    </tr>\n    <tr>\n      <th>33</th>\n      <td>PK</td>\n      <td>花生期权</td>\n    </tr>\n    <tr>\n      <th>34</th>\n      <td>sc</td>\n      <td>原油期权</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "optshare.get_option_info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 根据交易所名称，返回相应的期权信息\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "      标的代码        期权名称 交易市场名称  交易市场\n0   510050   上证50ETF期权    sse   上交所\n1   510300  沪深300ETF期权    sse   上交所\n2   510500  中证500ETF期权    sse   上交所\n3   159919  沪深300ETF期权   szse   深交所\n4   159922  中证500ETF期权   szse   深交所\n5   159915    创业板ETF期权   szse   深交所\n6   000300   沪深300股指期权  cffex   中金所\n7   000852  中证1000股指期权  cffex   中金所\n8   000016    上证50股指期权  cffex   中金所\n9       cu         铜期权   shfe   上期所\n10      al         铝期权   shfe   上期所\n11      zn         锌期权   shfe   上期所\n12      rb       螺纹钢期权   shfe   上期所\n13      au        黄金期权   shfe   上期所\n14      ag        白银期权   shfe   上期所\n15      ru        天胶期权   shfe   上期所\n16       m        豆粕期权    dce   大商所\n17       c        玉米期权    dce   大商所\n18       i       铁矿石期权    dce   大商所\n19      pg   液化石油天然气期权    dce   大商所\n20       l       聚乙烯期权    dce   大商所\n21       v      聚氯乙烯期权    dce   大商所\n22      pp       聚丙烯期权    dce   大商所\n23       p       棕榈油期权    dce   大商所\n24       a     黄大豆1号期权    dce   大商所\n25       b     黄大豆2号期权    dce   大商所\n26       y        豆油期权    dce   大商所\n27      SR        白糖期权   czce   郑商所\n28      CF        棉花期权   czce   郑商所\n29      TA       PTA期权   czce   郑商所\n30      MA        甲醇期权   czce   郑商所\n31      RM       菜籽粕期权   czce   郑商所\n32      OI       菜籽油期权   czce   郑商所\n33      PK        花生期权   czce   郑商所\n34      sc        原油期权    ine  上期能源",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>标的代码</th>\n      <th>期权名称</th>\n      <th>交易市场名称</th>\n      <th>交易市场</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>510050</td>\n      <td>上证50ETF期权</td>\n      <td>sse</td>\n      <td>上交所</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>510300</td>\n      <td>沪深300ETF期权</td>\n      <td>sse</td>\n      <td>上交所</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>510500</td>\n      <td>中证500ETF期权</td>\n      <td>sse</td>\n      <td>上交所</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>159919</td>\n      <td>沪深300ETF期权</td>\n      <td>szse</td>\n      <td>深交所</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>159922</td>\n      <td>中证500ETF期权</td>\n      <td>szse</td>\n      <td>深交所</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>159915</td>\n      <td>创业板ETF期权</td>\n      <td>szse</td>\n      <td>深交所</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>000300</td>\n      <td>沪深300股指期权</td>\n      <td>cffex</td>\n      <td>中金所</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>000852</td>\n      <td>中证1000股指期权</td>\n      <td>cffex</td>\n      <td>中金所</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>000016</td>\n      <td>上证50股指期权</td>\n      <td>cffex</td>\n      <td>中金所</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>cu</td>\n      <td>铜期权</td>\n      <td>shfe</td>\n      <td>上期所</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>al</td>\n      <td>铝期权</td>\n      <td>shfe</td>\n      <td>上期所</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>zn</td>\n      <td>锌期权</td>\n      <td>shfe</td>\n      <td>上期所</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>rb</td>\n      <td>螺纹钢期权</td>\n      <td>shfe</td>\n      <td>上期所</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>au</td>\n      <td>黄金期权</td>\n      <td>shfe</td>\n      <td>上期所</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>ag</td>\n      <td>白银期权</td>\n      <td>shfe</td>\n      <td>上期所</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>ru</td>\n      <td>天胶期权</td>\n      <td>shfe</td>\n      <td>上期所</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>m</td>\n      <td>豆粕期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>c</td>\n      <td>玉米期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>i</td>\n      <td>铁矿石期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>pg</td>\n      <td>液化石油天然气期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>l</td>\n      <td>聚乙烯期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>v</td>\n      <td>聚氯乙烯期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>pp</td>\n      <td>聚丙烯期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>p</td>\n      <td>棕榈油期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>a</td>\n      <td>黄大豆1号期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>b</td>\n      <td>黄大豆2号期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>y</td>\n      <td>豆油期权</td>\n      <td>dce</td>\n      <td>大商所</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>SR</td>\n      <td>白糖期权</td>\n      <td>czce</td>\n      <td>郑商所</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>CF</td>\n      <td>棉花期权</td>\n      <td>czce</td>\n      <td>郑商所</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>TA</td>\n      <td>PTA期权</td>\n      <td>czce</td>\n      <td>郑商所</td>\n    </tr>\n    <tr>\n      <th>30</th>\n      <td>MA</td>\n      <td>甲醇期权</td>\n      <td>czce</td>\n      <td>郑商所</td>\n    </tr>\n    <tr>\n      <th>31</th>\n      <td>RM</td>\n      <td>菜籽粕期权</td>\n      <td>czce</td>\n      <td>郑商所</td>\n    </tr>\n    <tr>\n      <th>32</th>\n      <td>OI</td>\n      <td>菜籽油期权</td>\n      <td>czce</td>\n      <td>郑商所</td>\n    </tr>\n    <tr>\n      <th>33</th>\n      <td>PK</td>\n      <td>花生期权</td>\n      <td>czce</td>\n      <td>郑商所</td>\n    </tr>\n    <tr>\n      <th>34</th>\n      <td>sc</td>\n      <td>原油期权</td>\n      <td>ine</td>\n      <td>上期能源</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "optshare.get_meta_data()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 根据交易所名称，返回相应的期权信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "     标的代码        期权名称 交易市场名称 交易市场\n6  000300   沪深300股指期权  cffex  中金所\n7  000852  中证1000股指期权  cffex  中金所\n8  000016    上证50股指期权  cffex  中金所",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>标的代码</th>\n      <th>期权名称</th>\n      <th>交易市场名称</th>\n      <th>交易市场</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>6</th>\n      <td>000300</td>\n      <td>沪深300股指期权</td>\n      <td>cffex</td>\n      <td>中金所</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>000852</td>\n      <td>中证1000股指期权</td>\n      <td>cffex</td>\n      <td>中金所</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>000016</td>\n      <td>上证50股指期权</td>\n      <td>cffex</td>\n      <td>中金所</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "optshare.get_meta_data(exchange_name = 'cffex')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
